﻿package mortal.game.view.arena.renderer
{
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.utils.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.view.arena.data.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;

    public class ArenaRankInfoCellRenderer extends GCellRenderer
    {
        private var _rankIcon:GBitmap;
        private var _rank:GTextFiled;
        private var _vipIcon:GImageBitmap;
        private var _roleName:GTextFiled;
        private var _combat:GTextFiled;
        private var _point:GTextFiled;
        private var _victoryRate:GTextFiled;
        private var _totalRank:GTextFiled;
        private var _lastDaySettle:GTextFiled;
        private var _lastWeekSettle:BaseItem;
        private var _rankData:ArenaRankData;

        public function ArenaRankInfoCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._rankIcon = UIFactory.gBitmap("", 18, 5, this);
            this._rank = UIFactory.gTextField("", 21 + 18, 4, 20, 20, this, GlobalStyle.textFormatBai);
            this._vipIcon = UIFactory.gImageBitmap("", 57 + 35 - 16, 10 - 6, this);
            this._roleName = UIFactory.gTextField("", 81 + 35, 4, 140, 20, this, GlobalStyle.textFormatHuang);
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.align = AlignMode.CENTER;
            this._combat = UIFactory.gTextField("", 259 - 20 + 27, 4, 70, 20, this, _loc_1);
            this._point = UIFactory.gTextField("", 333 + 59, 4, 53, 20, this, _loc_1);
            this._victoryRate = UIFactory.gTextField("", 417 + 69, 4, 46, 20, this, GlobalStyle.textFormatLv);
            var _loc_2:* = GlobalStyle.textFormatHuang2;
            _loc_2.align = AlignMode.CENTER;
            this._totalRank = UIFactory.gTextField("", 484 + 100, 4, 38, 20, this, _loc_2);
            this._lastDaySettle = UIFactory.gTextField("", 549 + 115 + 16, 4, 74, 20, this, _loc_1);
            this._lastWeekSettle = UICompomentPool.getUICompoment(BaseItem);
            this._lastWeekSettle.setItemStyle(ItemStyleConst.Little, "", 2, 2);
            this._lastWeekSettle.x = 690 + 134;
            this._lastWeekSettle.y = 2;
            this._lastWeekSettle.isShowPrescritime = false;
            this.addChild(this._lastWeekSettle);
            this.pushUIToDisposeVec(UIFactory.bg(-17, 29, 773 + 122 + 17, 2, this, ImagesConst.SplitLine));
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._rankData = param1 as ArenaRankData;
            this._rank.text = this._rankData.rank > 0 ? (this._rankData.rank + "") : ("--");
            this._roleName.text = this._rankData.roleName;
            this._combat.text = this._rankData.combat + "";
            this._point.text = this._rankData.point + "";
            this._victoryRate.text = this._rankData.victoryRate + "%";
            this._totalRank.text = this._rankData.totalRank > 0 ? (this._rankData.totalRank + "") : ("--");
            if (this._rankData.totalRank == -1)
            {
                this._totalRank.text = "";
            }
            this._lastDaySettle.text = this._rankData.lastDaySettleNum + "";
            if (this._rankData.lastWeekSettlePack > 0)
            {
                this._lastWeekSettle.visible = true;
                this._lastWeekSettle.itemCode = this._rankData.lastWeekSettlePack;
                this._lastWeekSettle.updateColorShow();
            }
            else
            {
                this._lastWeekSettle.visible = false;
            }
            switch(this._rankData.rank)
            {
                case 1:
                {
                    break;
                }
                case 2:
                {
                    break;
                }
                case 3:
                {
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (this._rankData.vipState > 0)
            {
                this._vipIcon.imgUrl = GameDefConfig.instance.getVipLevelIconUrl(this._rankData.vipState);
            }
            else
            {
                this._vipIcon.imgUrl = "";
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._rankIcon.dispose(param1);
            this._rank.dispose(param1);
            this._vipIcon.dispose(param1);
            this._roleName.dispose(param1);
            this._combat.dispose(param1);
            this._point.dispose(param1);
            this._victoryRate.dispose(param1);
            this._totalRank.dispose(param1);
            this._lastDaySettle.dispose(param1);
            this._lastWeekSettle.dispose(param1);
            this._rankIcon = null;
            this._rank = null;
            this._vipIcon = null;
            this._roleName = null;
            this._combat = null;
            this._point = null;
            this._victoryRate = null;
            this._totalRank = null;
            this._lastDaySettle = null;
            this._lastWeekSettle = null;
            this._rankData = null;
            return;
        }// end function

    }
}
